package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 默认佣金类型：0-无，1-佣金，2-佣金比例
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum DefaultCommissionTypeEnum {

    NULL(0, "无"),
    COMMISSION(1, "佣金"),
    COMMISSION_RATE(2, "佣金比例"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    DefaultCommissionTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static DefaultCommissionTypeEnum typeOf(Integer value) {
        DefaultCommissionTypeEnum[] values = DefaultCommissionTypeEnum.values();
        for (DefaultCommissionTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static DefaultCommissionTypeEnum typeOf(String name) {
        DefaultCommissionTypeEnum[] values = DefaultCommissionTypeEnum.values();
        for (DefaultCommissionTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
